<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="public::head('投票表决')">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8"></meta>

</head>
<body style="padding-top:50px;">
<input type="hidden" th:value="${session.Id}" id="id"/>
<input type="hidden" th:value="${session.Type}" id="Type"/>

<div th:replace="public/top_vote::top"></div>

<div id="Votelist">
    <div class="primary-title" style="height: 100%">
        <div style="margin-top:15px;text-align: center;font-size:24px">
            <label  style="margin-left: 20px; ">{{xiangmu.xiangmuname}}</label>
        </div>
        <div style="text-align: center;font-size:18px">
            <label  style="margin-left: 50px; ">品规总数： {{total}} 同意数： <font color="green">{{tongyishu}}</font></label>
            <input v-if="!issubmited" type="button" class="btn btn-sm btn-primary" style="width: 60px" value="提交" @click="tosubmit()">
            <input v-if="issubmited" type="button" class="btn btn-sm btn-success" disabled style="width: 60px" value="已提交" @click="tosubmit()">
        </div>
        <div v-if="!issubmited">
            <input type="button" class="btn btn-sm btn-danger" style="margin-right: 10px;float: right" value="全不同意" @click="toVoteAll(0)">
            <input type="button" class="btn btn-sm btn-success" style="margin-right: 10px;float: right" value="全同意" @click="toVoteAll(1)">
            <div style="clear: both"></div>
        </div>
    </div>

    <div class="primary-content">

        <div id="List"></div>
        <div v-if="!show" style="text-align:center;width:100%;">查无数据</div>


    </div>



</div>

</body>
<style>
    table{
        border:1px solid #e6e6e6;
        /* line-height: 5vh;*/
        color:#666666;
        font-size: 16px;
    }
    table {
        border-collapse: collapse;
        width: 100%;
    }
    td {
        padding:5px;
        border:1px solid #e6e6e6;
        font-size: 14px;
    }
    .table-head{padding-right:17px;background-color: #CDCDCD;color:#000;}
    .table-body{width:100%; height:550px;overflow-y:scroll;}
    .table-head table,.table-body table{width:100%;}
    /*  .table-body table tr:nth-child(2n+1){background-color:#f2f2f2;}*/

    .table-body table tr:hover {
        background-color:rgb(240, 249, 228);
        transition: .2s;
    }
</style>
<script th:src="@{/js/vote/list_hc1_vote.js}"></script>

<script type="text/javascript">
    var ID = $("#id").val();
    $(function() {
        if(ID==""){
            alert("请先登录！");
            location.href='../main/login';
        }
    });

    function toVote(ppId,ppPinzhong,ppPinpai,ppResult){
        layer.open({type: 3});
        $.post('/jieguo/toupiao', {
            id: ppId,
            pinzhong:ppPinzhong,
            pinpai:ppPinpai,
            userid:$("#id").val(),
            result: ppResult,
            rdm: Math.random()
        }, function (ppData) {
            layer.closeAll("loading");
            if (ppData != null) {
                if (ppData.result == "1") {
                    if(ppResult=="1"){
                        $("#div_"+ppPinzhong+"_"+ppPinpai+"").html("<span style=\"color:#008000\">同意</span>");
                    }
                    if(ppResult=="0"){
                        $("#div_"+ppPinzhong+"_"+ppPinpai+"").html("<span style=\"color:#ff0000\">不同意</span>");
                    }
                    vote.getResultCount();
                } else {
                    layer.alert(ppData.message);
                }
            }
        }, "json");

    }

</script>
</html>